boolean fireWorksFacet = false; // set to false
boolean setupFireWorksFacet=false;

ArrayList<Fire> zFire = new ArrayList();

//final float fw_X = 200;
//final float fw_Y = 50;
final float fw_G = 0.04;
int startTime;
float boom;
int fw_uTime =9;
int push = 0;

void setupFireWorksFF() {
  frameRate(60);
  colorMode(HSB, 360, 100, 100);
//  boom = random (1, fw_uTime)* random (1, fw_uTime);
  setupFireWorksFacet=false;
}

void drawFireWorksFF() {
  FacetAct=true;
  noStroke();
  fill(0, 50);
  if (width!=height){
    push=(width-height)/2;    
    translate (push,0);
  }
  rect(-push, 0, width, height);

  for (Fire fire : zFire) { 
    fire.vx += 0;
    fire.vy += fw_G;

    fire.x += fire.vx;
    fire.y += fire.vy;

    if (fire.lifetime-30>0) {
      noStroke();
      fill(fire.col, // RGB
      fire.lifetime-30); //Alpha

      ellipse(fire.x, fire.y, 6, 6); // draw the fire
      fire.lifetime -= 0.5; // decrease lifetime
    } else {
    }
  }
  if (frameCount-startTime > boom) {
    startTime=frameCount;
    boomTime();
  }
}
void boomTime() {
  boom = random (1, fw_uTime)* random (2,fw_uTime*2);
  int margin = height/3;
  float xBoom = random (margin, height-margin);
  float yBoom = random (margin, height-margin*2);
  boom(xBoom, yBoom);
}
void boom(float x, float y)
{
  float normy = 720/height;
  color c = color(random(0, 180), random(40, 100), 100);
  for (int i=0; i<random(200,600); i++) {
    float r = (random(0, TWO_PI))/normy;
    float R = (random(0, 3))/normy;
    zFire.add(new Fire(x, y, R*sin(r), R*cos(r), c));
  }
}

class Fire {
  float x;
  float y;
  float vx;
  float vy;

  color col;

  float lifetime = 100;

  Fire(float x, float y, float vx, float vy, color col) {
    this.x = x;
    this.y = y;
    this.vx = vx;
    this.vy = vy;
    this.col = col;
  }
}
